GameBricks
Python you can play.
pip install -e .
python -m gamebricks maze
THE GRID · Game(cells=8)
76543210
01234567
player(across=0, up=0)
coin(across=3, up=5)
ghost(across=7, up=7)
platform(across=2, up=1, width=3)
Two numbers. That's the whole map.
across = 0  is the far left
up     = 0  is the bottom
Just like a graph in maths. Type game.show_grid() and the numbers appear on screen so you can count squares with your finger.
PUT THINGS WHERE YOU WANT THEM
game.coin(across=3, up=5)
game.key(across=7, up=1)
game.door(across=0, up=6)
game.flag(across=4, up=7)
game.hearts(3)   # extra lives appear
game.ghost(across=6, up=6, speed=2)
game.spike(across=3, up=0, width=2)
game.platform(across=2, up=3, width=3)
game.ground()   # floor across the bottom
game.border()   # wall around the edge
OR START FROM A FINISHED GAME
game = gamebricks.load("platformer")
game.coin(across=6, up=6)   # your coin
game.jump_power(4)          # jump higher
game.start()
# catch · chase · maze · platformer · keys
GAMEBRICKS CHEAT SHEET · PAGE 1 OF 2 · THE GRID ages 9–14
The blocks
Every game is these six, mixed differently.
1 · WHO YOU ARE
hero = game.player(
    shape="hero",
    control="arrows",
    across=0, up=0)
control: arrows · wasd · mouse · arrows+jump
2 · HOW THINGS MOVE
game.place("ghost", across=4, up=6,
           move="chases", speed=3)
move: still · falls · falls_fast · drifts · chases · bounces
3 · AGAIN AND AGAIN
@game.every(1)
def drop():
    game.drop("star")
A loop. Every 1 second, a star falls in.
4 · WHEN TWO THINGS TOUCH
@game.when_touch(hero, "star")
def caught(star):
    game.score += 1
    star.burst()
do: burst() · remove() · say("hi") · grow() · shrink()
5 · WHAT YOU KEEP
game.score += 1
game.lives -= 1
game.hearts(3)
game.say("nice one!")
hearts(3) = 3 extra lives turn up as you play.
6 · HOW YOU WIN
game.win_when(
    game.collected_all("coin"))
score_reaches(15) · survived(20) · collected_all("coin") · reached("flag")
DRAW A LEVEL WITH YOUR KEYBOARD
game.level("""
    #######
    #@..#k#
    #.#.#.#
    #c..#.#
    ##.##.#
    #..c..d#
    #######
""")
#wall .empty @you ccoin kkey ddoor gghost *star =platform Fflag Hheart ^spike
What you draw is what you see. Several pictures in game.levels(a, b, c) become levels — win one and the next loads.
TRY THIS
Move the flag to across=7, up=7 — can you still reach it? Set jump_power(1) and build a staircase of platforms. Put a ghost in your maze. Make the stars fall at speed=9.
WHILE YOU PLAY
R restart P pause G grid M mute Esc quit
GAMEBRICKS CHEAT SHEET · PAGE 2 OF 2 · THE BLOCKS stuck? every example ends in # TRY THIS